;; Sri Ganeshji : Sri Balaji : Sri Pitreshwarji : Sri Durgaji : Sri Venkateshwara

/*

Added the UDF in ledger master and importing the ledger master from Excel to Tally.

Added UDF details:  
	1. City	
	2. Provide Emergency contact details -  Yes  (Contact Name, Number, Date of Birth and City)


To experience the capability, follow the steps given below:
	
	1. Excel data is require with ledger and emergency contact details
	2. Copy the TSF file to the TallyPrime application folder >> config >> excelmaps.

*/


[Report: TSPL Excel Import Capabilities]
	
	Use				: Range Value Template           															   
	Title			: $$LocaleString:"Custom Excel Import Capabilities"
	Form			: TSPL Excel Import Capabilities
	
[Form: TSPL Excel Import Capabilities]
	
	
	Use				: TSPL SMP Illustration
	
	Add				: Button: Blank Button 1,Blank Button 2,Blank Button 3,Blank Button 4,Blank Button 5,Blank Button 6,Blank Button 7		   
    
	Height			: 100% Screen
	Width			: 100% Screen
	
	Local	: Part	: TSPL SMP Syntax		: Invisible	: Yes
	Local	: Field	: FormSubTitle			: Info		: $$LocaleString:"Illustration of Import Data from Excel Using UDF Value"
		
	Local	: Field	: TSPL Smp Purpose		: Indent	: 2
	Local	: Field	: TSPL Smp Purpose		: Info		: $$NewLine + $$LocaleString:"To import data from Excel with UDF Value to TallyPrime. To view this, add UDF details in ledger master, import it from Excel to Tally, and define object for the same UDF to store the value." 
													
														
	Local	: Field	: TSPL SMP Example		: Indent	: 2													
	Local	: Field	: TSPL SMP Example		: Info		: $$newline + "[#Collection: List of LedgerTallyFields]	" + 
																		+ $$NewLine+"				Add				: Object				: TSPL ExlLedECDetails" + 
																		+ $$NewLine+"				Add				: Explode	: TSPL ExlLedECDetails  : ($$Type : TSPL ExlLedECDetails)" + $$NewLine + +
																	  "[Object : TSPL ExlLedECDetails]"  + 
																		+ $$NewLine+"				Use					: Label Object"  + 
																		+ $$NewLine+'				Use					: TSPL ExlDefaultLabelMethods'  +
																		+ $$NewLine+'				Name 	: $$LocalString: Emergency Contact Details' + $$NewLine + +
																	  "[Collection: TSPL ExlLedECDetails]" + 
																		+ $$NewLine+"				Use							: List of TallyFldTemplates"+ 
																		+ $$NewLine+"				Object   	: ExlLedECName, ExlLedECNumber, ExlLedECDOB, ExlLedECCity" + $$NewLine + +
																	  "[Object  : ExlLedECName]" +
																		+ $$NewLine+"				Use 														: TSPL Exl LedECDetails Template" + 
																		+ $$NewLine+'				Name												: $$LocalString: "Emergency Contact Name"' +
																		+ $$NewLine+'				ExlMethodName : "CTCName"' + 
																		+ $$NewLine+'				ExlIsKeyField 			: Yes' + 
																		+ $$NewLine+'				ExlPrmyVisbl 			: Yes' 
																	
    Local	: Field	: TSPL SMP ExampleNote	: Info		: "Importing data from Excel with UDF value (City, Emergency Contact Details - Conatct Name, Contact Number, Date of Birth, and City) to TallyPrime."  + $$NewLine + $$NewLine + +
														  "For more details, refer to the help article from help.tallysolutions.com\developer-reference" + $$NewLine + $$NewLine + +
														  "Added UDF details to the Ledger master and imported it from Excel to Tally. The added UDFs are:" + $$NewLine + $$Newline + +
														  " 1. 'City' and 2. Provide Emergency Contact Details (Yes). - Includes Contact Name, Contact number, Date of Birth and City" + $$NewLine +  $$NewLine + +
														  "To experience the capability, follow the steps given below:" + $$NewLine + $$NewLine + +
														  ' 1. Go to Import > Masters ' + $$NewLine + +
														  " 2. Ensure that the Excel file path is correctly setup. The Excel data should contain Ledger and Emergency Contact Details  and it is available under the 'Samples > Supporting Files' folder (ExcelImportUDF.xlsx)."  + $$NewLine + +
														  " 3. Copy the TSF file (ExcelImportUDF.tsf) from the aforementioned and paste it into the TallyPrime application folder > 'config' > 'excelmaps'"  + $$NewLine + +
														  " 4. Ensure that you have selected same mapping template (ExcelImportUDF) on the 'Import Masters' screen and proceed to import of data from Excel."
														  			

						
														


;; Define UDF to store the value 
[System: UDF]
	
	Emergency Contacts	: Aggregate		: 20001
	CTC Name		  	: String		: 20001
	CTC Number			: Number		: 20001
	CTC DOB				: Date			: 20001
	City				: String		: 20002	


;; Provision for UDF Objects in the Excel Import Table

;; Aggregate Ledger Object UDF

[#Collection: List of LedgerTallyFields]

	Add	: Object		: TSPL ExlLedECDetails
    Add	: Explode     	: TSPL ExlLedECDetails	 	: ($$Type = "TSPL ExlLedECDetails")					;; In collection define the object to store the UDF value 

[Object: TSPL ExlLedECDetails]
	
    Use                 : Label Object
    Use					: ExlDefaultLabelMethods

	Name	    		: $$LocaleString:"Emergency Contact Details"
	;ExlApplicability	: NOT $$IsEmpty:($$FilterValue:$Name:TSPLExlLedECDetails:First:ExlIsObjApplicable)

[Collection: TSPL ExlLedECDetails]																		;; Define the object to get the UDF object under excel import table list.
	
	Use					: List of TallyFldTemplate

    Object  			: ExlLedECName, ExlLedECNumber, ExlLedECDOB, ExlLedECCity						;; Define the object to store the UDF value in object						
	
	[Object: TSPL Exl LedECDetails Template]
		
		Use                 : ExlDefaultMethods
		Use                 : ExlDataTypeString

		ExlObjectType       : "Emergency Contacts"
		ExlCollectionName   : "Emergency Contacts"
	
	[Object: ExlLedECName]

		Use					: TSPL Exl LedECDetails Template

		Name				: $$LocaleString:"Emergency Contact Name"
		ExlMethodName       : "CTCName"
		ExlIsKeyField       : Yes		
		ExlPrmyVisbl        : Yes

	[Object: ExlLedECNumber]

		Use					: TSPL Exl LedECDetails Template

		Name				: $$LocaleString:"Emergency Contact Number"
		ExlMethodName       : "CTCNumber"
		ExlPrmyVisbl        : Yes

	[Object: ExlLedECDOB]

		Use					: TSPL Exl LedECDetails Template

		Name				: $$LocaleString:"Emergency Contact Date of Birth"
		ExlMethodName       : "CTCDOB"
		ExlPrmyVisbl        : Yes
 
	[Object: ExlLedECCity]

		Use					: TSPL Exl LedECDetails Template

		Name				: $$LocaleString:"Emergency Contact City"
		ExlMethodName       : "City"
		ExlPrmyVisbl        : Yes

;; Primary Ledger Object UDF

[#Collection: ExlLedMailDetails]																			;; Modified the collection to add the object for the city name
	
    Add	: Object  		: Before	: ExlLedState	: TSPL Ex1LedCity
	
[Object: TSPL Ex1LedCity]
	
	Use					: Exl LedMailingDetails

	Name				: $$LocaleString:"City"
    ExlMethodName       : "City"
	ExlPrmyVisbl        : Yes

    ExlObjectType 		: @@MstLedger
    ExlCollectionName   : ""



;; Ledger User Interface Fields

[#Part: LED Mailing Address]																				;; Added the fields in ledger master to import the city and emergency-
																											;; -contact details
	Add		: Bottom Lines	: Before	: LED State		: TSPL Cust LED City
	Height	: 12

[#Part: LED Mailing Parts]

	Add: Part: after : LED Mailing Address : TSPL LED Emg Contact Title, TSPL LED Emg Contact Parts			;; Added the part for define the title details of emergency contact details
	
[Part: TSPL LED Emg Contact Title]

    Line	: TSPL Cust LED Emergency Contacts Title
	Space Top	: 1
	
[Part: TSPL LED Emg Contact Parts]
	
	Line		: TSPL Cust LED Emergency Contacts
	Space Top	: 0.5
	
	[Line: TSPL Cust LED City]
		
		Fields	: Medium Prompt, TSPL Cust LED City
		Local	: Field	: Default			: Color		: Blue
		Local	: Field	: Medium Prompt		: Info		: "City :"
		Local	: Field	: Medium Prompt		: Style		: Small Bold
		
		[Field: TSPL Cust LED City]
			
			Use		: Name Field
			Storage	: City

	[Line: TSPL Cust LED Emergency Contacts Title]	
		
		Fields	: Name Field
			
		Local	: Field	: Name Field	: Info		: "Emergency Contact Details"
		Local	: Field	: Name Field    : Inactive	: NOT ##UseLedgerAddress 
		Local	: Field	: Name Field    : Skip		: Yes
		Local	: Field	: Name Field    : Fixed     : Yes
		Local	: Field	: Name Field    : Color		: Blue
		Local	: Field	: Name Field    : Border	: Sub Column Titles
		Local	: Field	: Name Field    : Style		: Small Bold
		
	[Line: TSPL Cust LED Emergency Contacts]
		
		Fields	: Long Prompt, Logical Field
		Local	: Field	: Default		: Color		: Blue
		Local	: Field	: Long Prompt	: Info		: "Provide Emergency Contact Details :"
		Local	: Field	: Logical Field	: Set as	: No
		Local	: Field	: Logical Field	: Sub Form	: TSPL Cust LED EC Details	: $$Value
		Local	: Field	: Name Field    : Style		: Small Bold

;; Emergency contact details report (After import show the contact name, number, DOB and city)
	
[Report:  TSPL Cust LED EC Details]																				
																										
	Form		: TSPL Cust LED EC Details
	Title		: "Emergency Contact Details for " + $Name
		
[Form: TSPL Cust LED EC Details]
	
	Parts		: Form SubTitle, TSPL Cust LED EC Details
	Height		: 30% Page
	Width		: 60% Page
	Local		: Field	: Form SubTitle		: Info		: "Emergency Contact Details"
	Space Left	: 2
	Space Right	: 2


[Part: TSPL Cust LED EC Details]
	
	Lines		: TSPL Cust LED EC Title, TSPL Cust LED EC Details
	Repeat		: TSPL Cust LED EC Details		: Emergency Contacts
	Scroll		: Vertical
	Break On	: $$IsEmpty:$CTCName
	Common Border: Yes
	Border		: Thin Box
		
	[Line: TSPL Cust LED EC Title]
		

		Fields	: Cust LEd SLNO, Cust LED EC Name, Cust LED EC Number, Cust LED EC DOB, Cust LED EC City
		Local	: Field	: Default			: Delete	: Storage
		Local	: Field	: Default			: Inactive	: No
		Local	: Field	: Default			: Type		: String
		Local	: Field	: Default			: Align		: Center
		Local	: Field	: Default			: Style		: Small Bold
					
		Local	: Field	: Cust LEd SLNO		: Info		: ""
		Local	: Field	: Cust LED EC Name	: Info		: "Contact Name"
		Local	: Field	: Cust LED EC Number: Info		: "Number"
		Local	: Field	: Cust LED EC DOB	: Info		: "Date of Birth"
		Local	: Field	: Cust LED EC City	: Info		: "City"
		Local	: Field	: Cust LEd SLNO		: Width		: 2
        Local	: Field	: Cust LED EC Name	: Width		: 20
        Local	: Field	: Cust LED EC Number: Width		: 20
		Local	: Field	: Cust LED EC DOB	: Width		: 20
	    Local	: Field	: Cust LED EC City	: Width		: 20
		Border	: Thin Bottom

	[Line: TSPL Cust LED EC Details]
		
		Fields	:  Cust LEd SLNO, Cust LED EC Name, Cust LED EC Number, Cust LED EC DOB, Cust LED EC City
		Local	: Field	: Default	: Style: Small
		

		[Field	: Cust LEd SLNO]
			
			Use			: Name field
			Width		: 2
			Set as		: $$Line
			Skip		: Yes
			Invisible	: Yes
	
		[Field: Cust LED EC Name]
			
			Use			: Name Field
			Storage		: CTC Name
			Width		: 20
	
		[Field: Cust LED EC Number]
			
			Use			: Number Field
			Storage		: CTC Number
			Format		: "NoZero, NoComma"
			Inactive	: $$IsEmpty:$CTCName
			Width		: 20
			Border		: Thin Left

		[Field: Cust LED EC DOB]
			
			Use			: Uni Date Field
			Storage		: CTC DOB
			Inactive	: $$IsEmpty:$CTCName
			Width		: 20
			Align		: Left
			Border		: Thin Left

		[Field: Cust LED EC City]
			
			Use			: Name Field
			Storage		: City
			Inactive	: $$IsEmpty:$CTCName
			Width		: 20
			Border		: Thin Left

;; Data Type for the below object was date and tested by changing it to due date

[*Object: ExlLedBillDueDate]																	 ;; Bill object for the bill allocation 

	Use					: ExlLedBillAllocations
    Use                 : ExlDataTypeDueDate

	Name      			: $$LocaleString:"Bill - Due Date"
	ExlMethodName       : "Bill Credit Period"
	

;; End-of-File